1. Field of the Invention
The invention relates to a system, program, and method for managing usage of memory on the basis of a memory management table, and more specifically, to a memory management apparatus, program, and method suitable for reducing amount of memory usage and simplifying programs.
2. Description of the Related Art
A Real Time OS (Operating System) (hereinafter referred to as RTOS) performs a plurality of tasks in parallel. Typically, memory management capability of a microprocessor-based system in which a RTOS is implemented is realized as a feature of the RTOS. As well, memory allocation functions and memory freeing functions typified by malloc function and free function of C language are often implemented such that they wrap memory functions of a RTOS.
Each task running on a RTOS calls a memory allocation function to obtain memory area necessary for processing. The memory allocation functional locates necessary used area from available memory areas of memory on the basis of a memory management table, registers the start pointer to the allocated used area to the memory management table and passes it to the requesting task.
Techniques for reading to/writing from memory area as a virtual two-dimensional space include a memory usage method disclosed in Japanese Patent Laid-Open No. 2002-222117 (JP2002-222117A), for example.
The invention described in JP2002-222117A assumes a predefined two-dimensional memory space that arranges a virtual minimum two-dimensional memory space in the vertical and horizontal orientations, and allocates in advance each address of the virtual minimum two-dimensional memory space to each address of n physical memory blocks that are determined relative to the virtual minimum two-dimensional memory space. When reading data, a read address of the virtual minimum two-dimensional memory space is specified and also the vertical or horizontal direction of data reading is specified with the read address as the reference. Based on both of the specifications, contiguous data stored in the vertical or horizontal orientation of the virtual minimum two-dimensional memory space is read from each of the addresses corresponding to the n memory blocks.
In such a conventional RTOS as described above, if different tasks need to share data, the tasks may share the same used area. If different tasks use a memory area for distinct purposes, however, there has been a problem of amount of memory usage increasing since different used areas are to be allocated for each of the tasks.
In addition to the problem above, the invention described in JP2002-222117A has also a problem of a program becoming complex because, in order to allocate a used area as a two-dimensional memory space, a program on the task side has to calculate the maximum width of the two-dimensional memory space and request a required size from a memory allocation function.
Thus, the invention has been made in view of such unsolved problems of prior art, and has an object of providing a memory management apparatus, program, and method suitable for reducing amount of memory usage and simplifying programs.